<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?=$titulo?></title>                
        <link href="<?=$this->config->item('base_url');?>/public/css/style.css" rel="stylesheet" type="text/css" />
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery-1.6.2.js"></script>
        

	
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.position.js"></script>
	<script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.core.js"></script>
	<script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.widget.js"></script>
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.button.js"></script>
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.tabs.js"></script>
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.dialog.js"></script>
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.datepicker.js"></script>
        <script src="<?=$this->config->item('base_url');?>/public/js/jquery.ui.datepicker-es.js"></script>
        <link rel="stylesheet" href="<?=$this->config->item('base_url');?>/public/css/jquery.ui.all.css">
      
	<!-- para menu 2-->
        <script type="text/javascript" src="<?=$this->config->item('base_url');?>/public/js/jquery.metadata.js"></script>
	<script type="text/javascript" src="<?=$this->config->item('base_url');?>/public/js/mbMenu.js"></script>
	<script type="text/javascript" src="<?=$this->config->item('base_url');?>/public/js/styleswitch.js"></script>
	<script type="text/javascript" src="<?=$this->config->item('base_url');?>/public/js/jquery.hoverIntent.js"></script>
	<link rel="stylesheet" type="text/css" href="<?=$this->config->item('base_url');?>/public/css/menu_black.css" title="styles1"  media="screen" />
	<link rel="alternate stylesheet" type="text/css" href="<?=$this->config->item('base_url');?>/public/css/menu_red.css" title="styles2" media="screen" />


        
        
        <script>

            
            
  /*
   * DEFAULT OPTIONS
   *
   options: {
   template:"yourMenuVoiceTemplate",--> the url that returns the menu voices via ajax. the data passed in the request is the "menu" attribute value as "menuId"
   additionalData:"",								--> if you need additional data to pass to the ajax call
   menuSelector:".menuContainer",		--> the css class for the menu container
   menuWidth:150,										--> min menu width
   openOnRight:false,								--> if the menu has to open on the right insted of bottom
   iconPath:"ico/",									--> the path for the icons on the left of the menu voice
   hasImages:true,									--> if the menuvoices have an icon (a space on the left is added for the icon)
   fadeInTime:100,									--> time in milliseconds to fade in the menu once you roll over the root voice
   fadeOutTime:200,									--> time in milliseconds to fade out the menu once you close the menu
   menuTop:0,												--> top space from the menu voice caller
   menuLeft:0,											--> left space from the menu voice caller
   submenuTop:0,										--> top space from the submenu voice caller
   submenuLeft:4,										--> left space from the submenu voice caller
   opacity:1,												--> opacity of the menu
   shadow:false,										--> if the menu has a shadow
   shadowColor:"black",							--> the color of the shadow
   shadowOpacity:.2,								--> the opacity of the shadow
   openOnClick:true,								--> if the menu has to be opened by a click event (otherwise is opened by a hover event)
   closeOnMouseOut:false,						--> if the menu has to be cloesed on mouse out
   closeAfter:500,									--> time in millisecond to whait befor closing menu once you mouse out
   minZindex:"auto", 								--> if set to "auto" the zIndex is automatically evaluate, otherwise it start from your settings ("auto" or int)
   hoverInted:0, 										--> if you use jquery.hoverinted.js set this to time in milliseconds to delay the hover event (0= false)
   onContextualMenu:function(o,e){} --> a function invoked once you call a contextual menu; it pass o (the menu you clicked on) and e (the event)
   },
   */

  $(function(){
    $(".myMenu").buildMenu(
    {
      additionalData:"pippo=1",
      menuWidth:200,
      openOnRight:false,
      menuSelector: ".menuContainer",
      iconPath:"<?=$this->config->item('base_url');?>/public/images/",
      hasImages:true,
      fadeInTime:100,
      fadeOutTime:300,
      adjustLeft:2,
      minZindex:"auto",
      adjustTop:10,
      opacity:.95,
      shadow:false,
      shadowColor:"#ccc",
      hoverIntent:0,
      openOnClick:true,
      closeOnMouseOut:false,
      closeAfter:1000,
      submenuHoverIntent:200
    });
  });

  //this function get the id of the element that fires the context menu.
  function testForContextMenu(el){
    if (!el) el= $.mbMenu.lastContextMenuEl;
    alert("the ID of the element is:   "+$(el).attr("id"));
  }

  function recallcMenu(el){
    if (!el) el= $.mbMenu.lastContextMenuEl;
    var cmenu=+$(el).attr("cmenu");
    $(cmenu).remove();
  }

  function loadFlash(){
    $.ajax({
      url:"testFlash/test.html",
      success:function(html){
        $("#flashTest").html(html);
      }
    });
  }

  function showMessage(msg){
    var msgBox=$("<div>").addClass("msgBox");
    $("body").append(msgBox);
    msgBox.append("You click on: <br>"+msg);
    setTimeout(function(){msgBox.fadeOut(500,function(){msgBox.remove();})},3000)
  }
  
  function navegar(url){
      //alert(url);
      url = "<?=$this->config->item('base_url');?>/index.php/" + url;
      //alert(url);
      window.location.href = url;
  }  
            
</script>
        
<style>
  
  .msgBox{
    position:absolute;
    width:250px;
    height:40px;
    background:black;
    -moz-box-shadow:#999 2px 0px 3px;
    -webkit-box-shadow:#999 2px 0px 3px;    
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    padding:10px;
    padding-top:30px;
    top:10px;
    right:10px;
    font:20px/24px Arial, Helvetica, sans-serif;
  }
    
</style>     
    </head>
        <?
        $usuario_session = $this->session->userdata('usuario_session');
        $empresas_usuario = $usuario_session['empresas'];
        $perfiles_usuario = $usuario_session['perfiles'];
        $menus = $this->session->userdata('menus_submodulos');          
        $id_modulo = $this->session->userdata('id_modulo');          
        //echo "menus:".$menus;
        ?>     
    <body>
        <img id="loadingImage" width="80px" heigth="80px" alt="loading..." src="<?=$this->config->item('base_url');?>/public/images/loading.gif" style="display: none; position: absolute; top: 70%; left: 45%" />                        

        <!-- INICIO CABECERA -->
        <table width="1024px" border="0" align="center"> 
        <tr>
            <td colspan="2"> 
                <table width="100%" border="0"> 
                <tr>
                    <td class="titulo">
                         ITCONT
                    </td>
                </tr>
                <tr>
                    <td class="subtitulo"><?=$usuario_session['nm_empresa_contab']?></td>
                </tr>                    
                </table>
            </td>
        </tr>
        <!-- FIN CABECERA -->
       
        <!--MENU HORIZONTAL-->
        <tr>
            <td colspan="2">
                <table width="100%" class="menu_horizontal">
                    <tr>
                        <td  width="40%"> 
                            <table width="100%">
                            <tr>
                                <td>Usuario:</td>
                                <td><?=$usuario_session['nombre']?></td>
                            </tr>
                            <tr>
                                <td>Rut:</td>
                                <td><?=$usuario_session['rut']?>-<?=$usuario_session['dv']?></td>
                            </tr> 
                            <tr>
                                <td>Perfiles:</td>
                                <td>
                                    <?foreach ($perfiles_usuario  as $perfil){ 
                                        echo $perfil['nm_perfil'];
                                    }?>
                                    
                                </td>
                            </tr>                             
                            </table>
                        </td>
                        <td  width="60%" valign="top">
                            <table width="100%">
                            <tr>
                                <td>Empresas:</td>
                                <td>
                                    <select class="ui-widget-content ui-corner-all" style="width:200px">
                                        <?foreach ($empresas_usuario  as $empresa){ ?>
                                            <option value="<?=$empresa['ID_EMPRESA'];?>"><?=$empresa['NM_EMPRESA'];?></option>                                            
                                        <?}?>
                                    </select>                                    
                                </td>
                            </tr>
                            <tr>
                                <td>Período:</td>
                                <td>
                                    <select class="ui-widget-content ui-corner-all" style="width:200px">
                                        <option>11/2011</option>
                                    </select>                                    
                                </td>
                            </tr>                            
                            </table>
                        </td>     
                    </tr>
                </table>                
            </td>
        </tr>
        <!--FIN MENU HORIZONTAL-->
        <tr>
            <td width="1024px" class="menu_vertical">               
                <table  width="1024px">
                    <tr>
                        <td  width="1024px">
                        <table width="100%"  border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td class="myMenu">
                              <table class="rootVoices" cellspacing='0' cellpadding='0' border='0'>
                              <tr>
                                  <?foreach ($menus  as $menu_horizontal){ 
                                        if(count($menu_horizontal['funcionalidades'])>0){?>
                                            <td align="center" class="rootVoice {menu: 'submodulo_<?=$menu_horizontal['id_submodulo']?>'}"  ><?=$menu_horizontal['nm_submodulo']?></td>                                  
                                        <?}else{?>
                                            <td align="center" class="rootVoice {menu: 'empty'}"  onclick="navegar('<?=$menu_horizontal['ruta']?>')"><?=$menu_horizontal['nm_submodulo']?></td>                                                                              
                                        <?}?>
                                  <?}?>
                                
                              </tr>
                              </table>

                              <!-- end horizontal menu -->

                            </td>
                                <td align="center">                                    
                                    <a href="/contab/index.php/iniciocontab"><img src="<?=$this->config->item('base_url')?>/public/images/Back Button_48.png" border="0" width="40px" heigth="40px"/></a>                                    
                                </td>                            
                          </tr>
                        </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <!--CUERPO-->
            <td width="1024px" valign="top">      
                <?=$cuerpo?>
            </td>
            <!--FIN CUERPO-->
        </tr>
        <!-- INICIO FOOT-->
        <tr>
            <td colspan="2">
                <table width="100%" border="0" class="pie_pagina"> 
                <tr>
                 <td align="center">
                       Pie Página
                 </td>
                </tr>
                </table>
            </td>
        </tr>
        <!-- FIN FOOT-->
        </table>
    <!-- FIN TEMPLATE -->      
  <?foreach ($menus  as $menu_horizontal){ 
      
      if(count($menu_horizontal['funcionalidades'])>0){          
          ?>
          <div id="submodulo_<?=$menu_horizontal['id_submodulo']?>" class="mbmenu">
              <a rel="title" ><?=$menu_horizontal['titulo']?></a> 
              <? foreach ($menu_horizontal['funcionalidades']  as $funcionalidad){ ?>              
                  <a rel="separator"> </a>               
                  <a class="{action: 'navegar(\'<?=$funcionalidad['ruta']?>\')', img: '<?=$funcionalidad['icono']?>'}"><?=$funcionalidad['nm_funcionalidad']?></a>     
                  <a rel="separator"> </a>               
              <? }?>s
          </div>      
  <?  }
  }?>


    
    </body>
</html>

